#ifndef KERN_BUF_H
#define KERN_BUF_H

#include <inc/types.h>
#include <kern/sleeplock.h>

#define BSIZE 512

struct buf {
  int32_t flags;
  uint32_t dev;
  uint32_t blockno;
  struct sleeplock lock;
  //TODO: a queue or other data structure to manage buf
  struct buf *next;
  uchar data[BSIZE];
};
#define B_VALID 0x2  // buffer has been read from disk
#define B_DIRTY 0x4  // buffer needs to be written to disk


// ioapic.c
void ioapic_init(void);
void ioapicenable(int irq, int cpunum);

// ide.c
void ideinit(void);
void ideintr(void);
void iderw(struct buf *b);

#endif /* !KERN_BUF_H */
